package com.itheima.Jiuye15;

import java.io.*;
import java.net.Socket;
import java.util.zip.InflaterInputStream;

public class ClientDemo01 {
    public static void main(String[] args) throws IOException {
        Socket socket = new Socket("127.0.0.1",1000);
        //创建本地流，用于读取本地文件
        BufferedInputStream bfr = new BufferedInputStream(new FileInputStream("C:\\Users\\纹龍\\Desktop\\复制版战城.jpg"));
        //写到服务器
        BufferedOutputStream bfos = new BufferedOutputStream(socket.getOutputStream());
        int a ;
        while ((a = bfr.read()) != -1){
            bfos.write(a);
        }
        bfos.flush();
        //给服务器一个标记告诉服务器文件已经传输完毕
        socket.shutdownOutput();
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
        String b ;
        while ((b = bufferedReader.readLine())!= null){
            System.out.println(b);
        }
        bfos.close();
        socket.close();
        bufferedReader.close();
    }
}
